package com.demo.morning;

/**
 * @ClassName 泛型
 * @Description TODO
 * @Author tianqinglong
 * @Date 10:47 2022/7/8
 * @Version 1.0
 **/
class P{//父类

}
class C extends P{//子类
    public void testC(){
        System.out.println("testC");
    }


}
class A{
    private P p;

    public A(P p) {
        this.p = p;
    }
    public void test(){
        C c=(C) p;
        c.testC();
    }
}
public class 泛型 {
    public static void main(String[] args) {
        A a = new A(new C());
        a.test();
    }
}
